#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "parport.h"

int main ( int argc, char *argv[] )
{
    int i=1;

    /* process command line arguments */
    if (argc == 1 || !strcmp(argv[i], "-h")||!strcmp(argv[i], "--help"))
    {
        printf("%s [read|write n] #where n is byte to write\n", argv[0]);
        exit(0);
    }

    if (!strcmp(argv[i], "write"))
    {
        if ( ++i != argc )
            port_write(atoi(argv[i]));
    }

    if (!strcmp(argv[i], "read"))
        fprintf(stdout,"%x\n",port_read());

    return 0;
}
